<template>
  <div class="container">
      <div class="list" v-for="(item,index) in list" :key="index" @click="handleClick(item)" >
        {{item.text}}
      </div>
  </div>
</template>

<script>

export default {
  data () {
    return {
      list: [
        {'text': '用户协议', 'url': './about/main'},
        {'text': '收费标准', 'url': './charge/main'},
        {'text': '关于我们', 'url': './protocol/main'},
        {'text': '退出登录', 'url': '.'}
      ]
    }
  },
  onLoad () {
    wx.setNavigationBarTitle({
      title: '设置'
    })
  },
  methods: {
    myDetail () {
      wx.navigateTo({
        url: '../my-detail/main'
      })
    },
    handleClick (e) {
      if (e.text === '退出登录') {
        wx.showModal({
          title: '提示',
          content: '确定退出？',
          success (res) {
            if (res.confirm) {
              console.log('用户点击确定')
            } else if (res.cancel) {
              console.log('用户点击取消')
            }
          }
        })
      } else {
        wx.navigateTo({
          url: e.url
        })
      }
    }
  }
}
</script>

<style scoped>
.container{
  position: fixed;
  max-height: 100%;
  width: 100%;
  background-color: #f5f5f5;
  justify-content: normal;
}
.list{
  padding-left: 40rpx;
  background-color: #fff;
  line-height: 80rpx;
  width: 100%;
  margin: 10rpx 0;
}
.list:nth-child(1){
  margin-top: 30rpx;
}
</style>
